package router

var (
	hashRing *HashRing
)

func InitServer(servers []string) {
	hashRing = NewHashRing(32)
	for _, server := range servers {
		hashRing.AddNode(server, 1)
	}
}

func UpdateServer(servers []string) {
	InitServer(servers)
}

func GetServer(s string) string {
	if hashRing == nil {
		panic("hashRing is nil")
	}
	return hashRing.GetNode(s)
}
